package com.log.log.common;//package com.log.log.common;
//
//import com.log.log.utils.JwtUtil;
//import org.springframework.stereotype.Component;
//import org.springframework.web.servlet.HandlerInterceptor;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
//@Component
//public class JwtInterceptor implements HandlerInterceptor {
//    @Override
//    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//        String username = JwtUtil.extractUsernameFromRequest(request);
//
//        if (username != null) {
//            // 将用户名存储到请求属性中，后续可以使用
//            request.setAttribute("username", username);
//            return true;
//        } else {
//            response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
//            return false;
//        }
//    }
//}
